Skip to content

[Studio] fix: preserve SSE framing for AI chat#438

Merged
lizhimins merged 1 commit into
apache:rocketmq-studiofrom
btlqql:agent/studio-sse-stream-framing
Jul 17, 2026
Merged

[Studio] fix: preserve SSE framing for AI chat#438
lizhimins merged 1 commit into
apache:rocketmq-studiofrom
btlqql:agent/studio-sse-stream-framing

Conversation

@btlqql

@btlqql btlqql commented Jul 16, 2026

Copy link
Copy Markdown

Summary

  • buffer AI chat stream bytes until a complete SSE event is available
  • handle fragmented, coalesced, CRLF, multiline, raw, and end-of-stream event data
  • accept both the existing content payload and the server stub's text payload
  • add focused regression coverage for SSE framing and the [DONE] sentinel

Root cause

chatStream split every network chunk on newlines and parsed it immediately. ReadableStream chunks do not preserve SSE event boundaries, so JSON split between chunks was treated as malformed raw text. The client also ignored the text field emitted by LlmGatewayStub.

Impact

AI responses are no longer lost or corrupted when an event is split or combined by the network, and the bundled backend stub now matches the frontend stream consumer.

Validation

  • cd web && npm test — 9 tests passed
  • cd web && npm run build — passed
  • cd web && npm run lint — 0 errors; 3 pre-existing warnings in unrelated files
  • pre-commit ESLint and Prettier checks — passed

Fixes #437

@lizhimins lizhimins changed the title [Studio][fix] Preserve SSE framing for AI chat [Studio] fix: preserve SSE framing for AI chat Jul 17, 2026
@lizhimins
lizhimins merged commit d9a1ac3 into apache:rocketmq-studio Jul 17, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants